package com.aba.cjms.pojo;

import java.sql.Connection;
import java.sql.DriverManager;

public class ConnectionDatabaseForMySQLUseJdbc {
	private static final String DRIVER = "com.mysql.cj.jdbc.Driver";
	private static final String URL = "Jdbc:mysql://localhost:3306/crm";
	private static final String USER = "root";
	private static final String PASSWORD = "202812";
	
	static Connection connection;
	
	 public static  Connection getConnection() throws Exception{
		 //	加载数据库驱动
		 Class.forName(DRIVER);
		 //连接数据库，采用驱动管理器连接。 （连接地址，账号，密码）
		 connection = DriverManager.getConnection(URL, USER, PASSWORD);
		return connection;
		 
	 }
//public static void main(String[] args) throws Exception {
//	
//	
//	
//	connection = getConnection();
//	
//	System.out.println(null != connection);
//	
//}
	
}
